/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.edu.hcmut.cse.ai.search.test;

import java.util.List;
import vn.edu.hcmut.cse.ai.infrastructure.Action;
import vn.edu.hcmut.cse.ai.infrastructure.Problem;
import vn.edu.hcmut.cse.ai.search.local.HeuristicFunction;
import vn.edu.hcmut.cse.ai.search.local.SimpleHillClimbingSearch;
import vn.edu.hcmut.cse.ai.search.uninformed.BreadthFirstSearch;
import vn.edu.hcmut.cse.ai.search.uninformed.DepthFirstSearch;

public class Thread {

}

class threadBFS implements Runnable {

    Problem problems;

    public threadBFS(Problem problems) {
        this.problems = problems;
    }

    @Override
    public void run() {
        BreadthFirstSearch bfsSearch = new BreadthFirstSearch();
        List<Action> bfsActionList = bfsSearch.doSearching(problems);
        if (bfsActionList.isEmpty()) {
            System.out.println("No Solution!");
        }
        for (Action anAction : bfsActionList) {
            Action action = (Action) anAction;
            System.out.println(action.toString());
        }
    }
}

class threadDFS implements Runnable {

    Problem problems;

    public threadDFS(Problem problems) {
        this.problems = problems;
    }

    @Override
    public void run() {
        DepthFirstSearch dfsSearch = new DepthFirstSearch();
        List<Action> dfsActionList = dfsSearch.doSearching(problems);
        if (dfsActionList.isEmpty()) {
            System.out.println("No Solution!");
        }
        for (Action anAction : dfsActionList) {
            Action action = (Action) anAction;
            System.out.println(action.toString());
        }
    }
}

class firstHeuristicFunction implements Runnable {

    HeuristicFunction heuristicFunction;
    Problem problem;

    public firstHeuristicFunction(HeuristicFunction heuristicFunction, Problem problem) {
        this.heuristicFunction = heuristicFunction;
        this.problem = problem;
    }

    @Override
    public void run() {
        SimpleHillClimbingSearch simpleHillClimbingSearch = new SimpleHillClimbingSearch(this.heuristicFunction);
        List<Action> searchResult = simpleHillClimbingSearch.doSearching(problem);
        if (searchResult.isEmpty()) {
            System.out.println("No solution!");
        }
        for (Action anAction : searchResult) {
            System.out.println(anAction);
        }
    }
}

class secondHeuristicFunction implements Runnable {

    HeuristicFunction heuristicFunction;
    Problem problem;

    public secondHeuristicFunction(HeuristicFunction heuristicFunction, Problem problem) {
        this.heuristicFunction = heuristicFunction;
        this.problem = problem;
    }

    @Override
    public void run() {
        SimpleHillClimbingSearch simpleHillClimbingSearch = new SimpleHillClimbingSearch(this.heuristicFunction);
        List<Action> searchResult = simpleHillClimbingSearch.doSearching(problem);
        if (searchResult.isEmpty()) {
            System.out.println("No solution!");
        }
        for (Action anAction : searchResult) {
            System.out.println(anAction);
        }
    }
}
